<?php
    /**
     * User zgh
     * Email 1803897171@qq.com
     * Date 2021/7/25
     **/

    namespace app\admin\service;

    use app\admin\pipeline\ItemAdapter;
    use app\common\model\UploadModel;

    class UploadService extends \app\common\service\UploadService
    {
        public static function getList($params)
        {
            $pagination = filter_pagination(@$params['page'], @$params['limit']);
            $data = [];
            $query = UploadModel::where([['status', '<>', -1]])->order(["id" => "desc"]);
            $data['total'] = $query->count();
            $data['dataList'] = [];
            if ($data['total']) {
                $data['dataList'] = $query->limit($pagination['start'], $pagination['limit'])->append(['size_text','platform_text'])->select()->toArray();
            }
            return $data;
        }


        public static function del($params)
        {
            $adapter = new ItemAdapter(UploadModel::class);
            return $adapter->whereUpdate([["id", "in", $params['id']]],["status" => -1]);
        }


    }